package com.ruoyi.develop.orderIronRecordBuy.service.impl;

import java.util.List;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.ruoyi.develop.orderIronRecordBuy.mapper.OrderIronRecordBuyMapper;
import com.ruoyi.develop.orderIronRecordBuy.domain.OrderIronRecordBuy;
import com.ruoyi.develop.orderIronRecordBuy.service.IOrderIronRecordBuyService;

/**
 * 铁件拆解记录与采购单关联Service业务层处理
 *
 * @author lmm
 * @date 2025-06-21
 */
@Service
public class OrderIronRecordBuyServiceImpl implements IOrderIronRecordBuyService {
    @Resource
    private OrderIronRecordBuyMapper orderIronRecordBuyMapper;

    /**
     * 查询铁件拆解记录与采购单关联
     *
     * @param id 铁件拆解记录与采购单关联主键
     * @return 铁件拆解记录与采购单关联
     */
    @Override
    public OrderIronRecordBuy selectById(String id) {
        return orderIronRecordBuyMapper.selectById(id);
    }

    /**
     * 查询铁件拆解记录与采购单关联列表
     *
     * @param entity 铁件拆解记录与采购单关联
     * @return 铁件拆解记录与采购单关联
     */
    @Override
    public List<OrderIronRecordBuy> selectList(OrderIronRecordBuy entity) {
        return orderIronRecordBuyMapper.selectList(entity);
    }

    /**
     * 新增铁件拆解记录与采购单关联
     *
     * @param entity 铁件拆解记录与采购单关联
     * @return 结果
     */
    @Override
    public int insert(OrderIronRecordBuy entity) {
        if (StringUtils.isBlank(entity.getId())) {
            entity.setId(IdUtils.fastSimpleUUID());
        }
        entity.setCreateBy(SecurityUtils.getUsername());
        entity.setCreateTime(DateUtils.getNowDate());
        return orderIronRecordBuyMapper.insert(entity);
    }

    /**
     * 修改铁件拆解记录与采购单关联
     *
     * @param entity 铁件拆解记录与采购单关联
     * @return 结果
     */
    @Override
    public int update(OrderIronRecordBuy entity) {
        entity.setUpdateBy(SecurityUtils.getUsername());
        entity.setUpdateTime(DateUtils.getNowDate());
        return orderIronRecordBuyMapper.update(entity);
    }

    /**
     * 批量删除铁件拆解记录与采购单关联
     *
     * @param ids 需要删除的铁件拆解记录与采购单关联主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return orderIronRecordBuyMapper.deleteByIds(ids);
    }

    /**
     * 删除铁件拆解记录与采购单关联信息
     *
     * @param id 铁件拆解记录与采购单关联主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return orderIronRecordBuyMapper.deleteById(id);
    }
}
